package com.dynamic.model.dao.impl;

import java.util.ArrayList;
import java.util.List;
import com.dynamic.model.common.dao.impl.BaseDaoImpl;
import com.dynamic.model.common.vo.Page;
import com.dynamic.model.dao.SystemRoleDao;
import com.dynamic.model.model.po.SysmanRole;
import org.springframework.stereotype.Repository;


/**
 * 
 * @desc 用户后台登陆用户角色表--RBAC权限管理dao接口实现类
 *
 * @author luwei
 * @Fri Aug 08 14:27:52 CST 2014
 */
@Repository
public class SystemRoleDaoImpl extends BaseDaoImpl<SysmanRole> implements SystemRoleDao {

	@Override
	public List<SysmanRole> getPageDataReqName(Page<SysmanRole> page, String rolename, int currentUserId) {
		List<Object> prams=new ArrayList<Object>();
		String hql="from SysmanRole t where t.deleteFlag = 0 and t.roleType=1 and t.creater="+currentUserId;
		if(null!=rolename&&rolename.length()>0){
			hql=hql+" and t.name=?";
			prams.add(rolename);
		}
		hql=hql+" order by t.createTime desc,pid desc";
		return this.queryForList(hql, prams, page );
	}
	

}
